{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "86f181a7",
   "metadata": {},
   "source": [
    "## Resampling data for different time frames"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "49041b9b",
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import pandas as pd\n",
    "from IPython.display import display\n",
    "from openbb import obb"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "6997fd9f",
   "metadata": {},
   "outputs": [],
   "source": [
    "obb.user.preferences.output_type = \"dataframe\""
   ]
  },
  {
   "cell_type": "markdown",
   "id": "650ac797",
   "metadata": {},
   "source": [
    "Fetches historical intraday price data for the equity \"AAPL\" with 1-minute intervals using the \"yfinance\" provider and stores it in 'df'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "0395e096",
   "metadata": {},
   "outputs": [],
   "source": [
    "df = obb.equity.price.historical(\"AAPL\", interval=\"1m\", provider=\"yfinance\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "f33824c1",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>open</th>\n",
       "      <th>high</th>\n",
       "      <th>low</th>\n",
       "      <th>close</th>\n",
       "      <th>volume</th>\n",
       "      <th>split_ratio</th>\n",
       "      <th>dividend</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>date</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2024-06-10 09:30:00</th>\n",
       "      <td>197.199997</td>\n",
       "      <td>197.281693</td>\n",
       "      <td>196.410004</td>\n",
       "      <td>197.020004</td>\n",
       "      <td>3067393</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2024-06-10 09:31:00</th>\n",
       "      <td>196.990005</td>\n",
       "      <td>197.029999</td>\n",
       "      <td>196.699997</td>\n",
       "      <td>196.753494</td>\n",
       "      <td>414503</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2024-06-10 09:32:00</th>\n",
       "      <td>196.770004</td>\n",
       "      <td>196.800003</td>\n",
       "      <td>196.360001</td>\n",
       "      <td>196.565002</td>\n",
       "      <td>464379</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2024-06-10 09:33:00</th>\n",
       "      <td>196.559998</td>\n",
       "      <td>196.960007</td>\n",
       "      <td>196.550003</td>\n",
       "      <td>196.880005</td>\n",
       "      <td>284067</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2024-06-10 09:34:00</th>\n",
       "      <td>196.875000</td>\n",
       "      <td>196.939896</td>\n",
       "      <td>196.679993</td>\n",
       "      <td>196.820007</td>\n",
       "      <td>205338</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2024-06-14 15:55:00</th>\n",
       "      <td>212.279999</td>\n",
       "      <td>212.490005</td>\n",
       "      <td>212.270096</td>\n",
       "      <td>212.434998</td>\n",
       "      <td>374658</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2024-06-14 15:56:00</th>\n",
       "      <td>212.434998</td>\n",
       "      <td>212.520004</td>\n",
       "      <td>212.413803</td>\n",
       "      <td>212.449997</td>\n",
       "      <td>448005</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2024-06-14 15:57:00</th>\n",
       "      <td>212.445007</td>\n",
       "      <td>212.500000</td>\n",
       "      <td>212.311005</td>\n",
       "      <td>212.490005</td>\n",
       "      <td>339171</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2024-06-14 15:58:00</th>\n",
       "      <td>212.500000</td>\n",
       "      <td>212.580002</td>\n",
       "      <td>212.490005</td>\n",
       "      <td>212.565002</td>\n",
       "      <td>479071</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2024-06-14 15:59:00</th>\n",
       "      <td>212.565002</td>\n",
       "      <td>212.587906</td>\n",
       "      <td>212.350006</td>\n",
       "      <td>212.520004</td>\n",
       "      <td>1061034</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>1947 rows × 7 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                           open        high         low       close   volume  \\\n",
       "date                                                                           \n",
       "2024-06-10 09:30:00  197.199997  197.281693  196.410004  197.020004  3067393   \n",
       "2024-06-10 09:31:00  196.990005  197.029999  196.699997  196.753494   414503   \n",
       "2024-06-10 09:32:00  196.770004  196.800003  196.360001  196.565002   464379   \n",
       "2024-06-10 09:33:00  196.559998  196.960007  196.550003  196.880005   284067   \n",
       "2024-06-10 09:34:00  196.875000  196.939896  196.679993  196.820007   205338   \n",
       "...                         ...         ...         ...         ...      ...   \n",
       "2024-06-14 15:55:00  212.279999  212.490005  212.270096  212.434998   374658   \n",
       "2024-06-14 15:56:00  212.434998  212.520004  212.413803  212.449997   448005   \n",
       "2024-06-14 15:57:00  212.445007  212.500000  212.311005  212.490005   339171   \n",
       "2024-06-14 15:58:00  212.500000  212.580002  212.490005  212.565002   479071   \n",
       "2024-06-14 15:59:00  212.565002  212.587906  212.350006  212.520004  1061034   \n",
       "\n",
       "                     split_ratio  dividend  \n",
       "date                                        \n",
       "2024-06-10 09:30:00          0.0       0.0  \n",
       "2024-06-10 09:31:00          0.0       0.0  \n",
       "2024-06-10 09:32:00          0.0       0.0  \n",
       "2024-06-10 09:33:00          0.0       0.0  \n",
       "2024-06-10 09:34:00          0.0       0.0  \n",
       "...                          ...       ...  \n",
       "2024-06-14 15:55:00          0.0       0.0  \n",
       "2024-06-14 15:56:00          0.0       0.0  \n",
       "2024-06-14 15:57:00          0.0       0.0  \n",
       "2024-06-14 15:58:00          0.0       0.0  \n",
       "2024-06-14 15:59:00          0.0       0.0  \n",
       "\n",
       "[1947 rows x 7 columns]"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "display(df)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "a6abf79c",
   "metadata": {},
   "source": [
    "Resamples the 'close' column of 'df' to hourly frequency and stores it in 'resampled'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "5fbc58ac",
   "metadata": {},
   "outputs": [],
   "source": [
    "resampled = df.resample(rule=\"h\")[\"close\"]"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "1775442e",
   "metadata": {},
   "source": [
    "Displays the first value of each hour in the resampled data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "59c5d002",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "date\n",
       "2024-06-10 09:00:00    197.020004\n",
       "2024-06-10 10:00:00    195.399994\n",
       "2024-06-10 11:00:00    195.354996\n",
       "2024-06-10 12:00:00    195.190002\n",
       "2024-06-10 13:00:00    195.645004\n",
       "                          ...    \n",
       "2024-06-14 11:00:00    213.063095\n",
       "2024-06-14 12:00:00    212.301300\n",
       "2024-06-14 13:00:00    211.945007\n",
       "2024-06-14 14:00:00    212.270004\n",
       "2024-06-14 15:00:00    212.074997\n",
       "Freq: h, Name: close, Length: 103, dtype: float64"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "resampled.first()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "a02a9d11",
   "metadata": {},
   "source": [
    "Displays the last value of each hour in the resampled data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "350371a9",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "date\n",
       "2024-06-10 09:00:00    195.410004\n",
       "2024-06-10 10:00:00    195.384995\n",
       "2024-06-10 11:00:00    195.229996\n",
       "2024-06-10 12:00:00    195.619995\n",
       "2024-06-10 13:00:00    194.949997\n",
       "                          ...    \n",
       "2024-06-14 11:00:00    212.550003\n",
       "2024-06-14 12:00:00    212.179993\n",
       "2024-06-14 13:00:00    212.372101\n",
       "2024-06-14 14:00:00    212.164993\n",
       "2024-06-14 15:00:00    212.520004\n",
       "Freq: h, Name: close, Length: 103, dtype: float64"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "resampled.last()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "733c358d",
   "metadata": {},
   "source": [
    "Calculates the mean of each hour in the resampled data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "e52e7c0c",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "date\n",
       "2024-06-10 09:00:00    195.933544\n",
       "2024-06-10 10:00:00    195.369196\n",
       "2024-06-10 11:00:00    195.432972\n",
       "2024-06-10 12:00:00    195.801304\n",
       "2024-06-10 13:00:00    195.285980\n",
       "                          ...    \n",
       "2024-06-14 11:00:00    213.249061\n",
       "2024-06-14 12:00:00    211.905609\n",
       "2024-06-14 13:00:00    211.949189\n",
       "2024-06-14 14:00:00    212.011808\n",
       "2024-06-14 15:00:00    212.134300\n",
       "Freq: h, Name: close, Length: 103, dtype: float64"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "resampled.mean()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "5d950bb8",
   "metadata": {},
   "source": [
    "Calculates the open, high, low, and close (OHLC) for each hour in the resampled data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "2d47407f",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>open</th>\n",
       "      <th>high</th>\n",
       "      <th>low</th>\n",
       "      <th>close</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>date</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2024-06-10 09:00:00</th>\n",
       "      <td>197.020004</td>\n",
       "      <td>197.020004</td>\n",
       "      <td>195.210007</td>\n",
       "      <td>195.410004</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2024-06-10 10:00:00</th>\n",
       "      <td>195.399994</td>\n",
       "      <td>195.710007</td>\n",
       "      <td>195.014999</td>\n",
       "      <td>195.384995</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2024-06-10 11:00:00</th>\n",
       "      <td>195.354996</td>\n",
       "      <td>195.664993</td>\n",
       "      <td>195.119995</td>\n",
       "      <td>195.229996</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2024-06-10 12:00:00</th>\n",
       "      <td>195.190002</td>\n",
       "      <td>196.198807</td>\n",
       "      <td>195.190002</td>\n",
       "      <td>195.619995</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2024-06-10 13:00:00</th>\n",
       "      <td>195.645004</td>\n",
       "      <td>196.339996</td>\n",
       "      <td>193.509995</td>\n",
       "      <td>194.949997</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2024-06-14 11:00:00</th>\n",
       "      <td>213.063095</td>\n",
       "      <td>213.800003</td>\n",
       "      <td>212.535004</td>\n",
       "      <td>212.550003</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2024-06-14 12:00:00</th>\n",
       "      <td>212.301300</td>\n",
       "      <td>212.490005</td>\n",
       "      <td>211.338699</td>\n",
       "      <td>212.179993</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2024-06-14 13:00:00</th>\n",
       "      <td>211.945007</td>\n",
       "      <td>212.384995</td>\n",
       "      <td>211.412796</td>\n",
       "      <td>212.372101</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2024-06-14 14:00:00</th>\n",
       "      <td>212.270004</td>\n",
       "      <td>212.360001</td>\n",
       "      <td>211.725006</td>\n",
       "      <td>212.164993</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2024-06-14 15:00:00</th>\n",
       "      <td>212.074997</td>\n",
       "      <td>212.565002</td>\n",
       "      <td>211.485703</td>\n",
       "      <td>212.520004</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>103 rows × 4 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                           open        high         low       close\n",
       "date                                                               \n",
       "2024-06-10 09:00:00  197.020004  197.020004  195.210007  195.410004\n",
       "2024-06-10 10:00:00  195.399994  195.710007  195.014999  195.384995\n",
       "2024-06-10 11:00:00  195.354996  195.664993  195.119995  195.229996\n",
       "2024-06-10 12:00:00  195.190002  196.198807  195.190002  195.619995\n",
       "2024-06-10 13:00:00  195.645004  196.339996  193.509995  194.949997\n",
       "...                         ...         ...         ...         ...\n",
       "2024-06-14 11:00:00  213.063095  213.800003  212.535004  212.550003\n",
       "2024-06-14 12:00:00  212.301300  212.490005  211.338699  212.179993\n",
       "2024-06-14 13:00:00  211.945007  212.384995  211.412796  212.372101\n",
       "2024-06-14 14:00:00  212.270004  212.360001  211.725006  212.164993\n",
       "2024-06-14 15:00:00  212.074997  212.565002  211.485703  212.520004\n",
       "\n",
       "[103 rows x 4 columns]"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "resampled.ohlc()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "c0af8844",
   "metadata": {},
   "source": [
    "Converts 'df' to a daily frequency and stores it in 'ddf'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "b0a669ed",
   "metadata": {},
   "outputs": [],
   "source": [
    "ddf = df.asfreq(\"D\").to_period()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "9c1783b9",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>open</th>\n",
       "      <th>high</th>\n",
       "      <th>low</th>\n",
       "      <th>close</th>\n",
       "      <th>volume</th>\n",
       "      <th>split_ratio</th>\n",
       "      <th>dividend</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>date</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2024-06-10</th>\n",
       "      <td>197.199997</td>\n",
       "      <td>197.281693</td>\n",
       "      <td>196.410004</td>\n",
       "      <td>197.020004</td>\n",
       "      <td>3067393</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2024-06-11</th>\n",
       "      <td>193.660004</td>\n",
       "      <td>194.589996</td>\n",
       "      <td>193.639999</td>\n",
       "      <td>194.304993</td>\n",
       "      <td>3043228</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2024-06-12</th>\n",
       "      <td>207.750000</td>\n",
       "      <td>207.850006</td>\n",
       "      <td>207.750000</td>\n",
       "      <td>207.835007</td>\n",
       "      <td>7180035</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2024-06-13</th>\n",
       "      <td>215.185394</td>\n",
       "      <td>215.229202</td>\n",
       "      <td>215.169998</td>\n",
       "      <td>215.205795</td>\n",
       "      <td>6325074</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2024-06-14</th>\n",
       "      <td>213.809998</td>\n",
       "      <td>214.114105</td>\n",
       "      <td>213.660004</td>\n",
       "      <td>214.089996</td>\n",
       "      <td>2328878</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                  open        high         low       close   volume  \\\n",
       "date                                                                  \n",
       "2024-06-10  197.199997  197.281693  196.410004  197.020004  3067393   \n",
       "2024-06-11  193.660004  194.589996  193.639999  194.304993  3043228   \n",
       "2024-06-12  207.750000  207.850006  207.750000  207.835007  7180035   \n",
       "2024-06-13  215.185394  215.229202  215.169998  215.205795  6325074   \n",
       "2024-06-14  213.809998  214.114105  213.660004  214.089996  2328878   \n",
       "\n",
       "            split_ratio  dividend  \n",
       "date                               \n",
       "2024-06-10          0.0       0.0  \n",
       "2024-06-11          0.0       0.0  \n",
       "2024-06-12          0.0       0.0  \n",
       "2024-06-13          0.0       0.0  \n",
       "2024-06-14          0.0       0.0  "
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "display(ddf)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "e06ae224",
   "metadata": {},
   "source": [
    "Converts 'df' to a business day frequency and stores it in 'ddf'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "ed35073e",
   "metadata": {},
   "outputs": [],
   "source": [
    "ddf = df.asfreq(pd.offsets.BDay())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "2264950c",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>open</th>\n",
       "      <th>high</th>\n",
       "      <th>low</th>\n",
       "      <th>close</th>\n",
       "      <th>volume</th>\n",
       "      <th>split_ratio</th>\n",
       "      <th>dividend</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>date</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2024-06-10 09:30:00</th>\n",
       "      <td>197.199997</td>\n",
       "      <td>197.281693</td>\n",
       "      <td>196.410004</td>\n",
       "      <td>197.020004</td>\n",
       "      <td>3067393</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2024-06-11 09:30:00</th>\n",
       "      <td>193.660004</td>\n",
       "      <td>194.589996</td>\n",
       "      <td>193.639999</td>\n",
       "      <td>194.304993</td>\n",
       "      <td>3043228</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2024-06-12 09:30:00</th>\n",
       "      <td>207.750000</td>\n",
       "      <td>207.850006</td>\n",
       "      <td>207.750000</td>\n",
       "      <td>207.835007</td>\n",
       "      <td>7180035</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2024-06-13 09:30:00</th>\n",
       "      <td>215.185394</td>\n",
       "      <td>215.229202</td>\n",
       "      <td>215.169998</td>\n",
       "      <td>215.205795</td>\n",
       "      <td>6325074</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2024-06-14 09:30:00</th>\n",
       "      <td>213.809998</td>\n",
       "      <td>214.114105</td>\n",
       "      <td>213.660004</td>\n",
       "      <td>214.089996</td>\n",
       "      <td>2328878</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                           open        high         low       close   volume  \\\n",
       "date                                                                           \n",
       "2024-06-10 09:30:00  197.199997  197.281693  196.410004  197.020004  3067393   \n",
       "2024-06-11 09:30:00  193.660004  194.589996  193.639999  194.304993  3043228   \n",
       "2024-06-12 09:30:00  207.750000  207.850006  207.750000  207.835007  7180035   \n",
       "2024-06-13 09:30:00  215.185394  215.229202  215.169998  215.205795  6325074   \n",
       "2024-06-14 09:30:00  213.809998  214.114105  213.660004  214.089996  2328878   \n",
       "\n",
       "                     split_ratio  dividend  \n",
       "date                                        \n",
       "2024-06-10 09:30:00          0.0       0.0  \n",
       "2024-06-11 09:30:00          0.0       0.0  \n",
       "2024-06-12 09:30:00          0.0       0.0  \n",
       "2024-06-13 09:30:00          0.0       0.0  \n",
       "2024-06-14 09:30:00          0.0       0.0  "
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "display(ddf)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "d12ff1c5",
   "metadata": {},
   "source": [
    "**Jason Strimpel** is the founder of <a href='https://pyquantnews.com/'>PyQuant News</a> and co-founder of <a href='https://www.tradeblotter.io/'>Trade Blotter</a>. His career in algorithmic trading spans 20+ years. He previously traded for a Chicago-based hedge fund, was a risk manager at JPMorgan, and managed production risk technology for an energy derivatives trading firm in London. In Singapore, he served as APAC CIO for an agricultural trading firm and built the data science team for a global metals trading firm. Jason holds degrees in Finance and Economics and a Master's in Quantitative Finance from the Illinois Institute of Technology. His career spans America, Europe, and Asia. He shares his expertise through the <a href='https://pyquantnews.com/subscribe-to-the-pyquant-newsletter/'>PyQuant Newsletter</a>, social media, and has taught over 1,000+ algorithmic trading with Python in his popular course **<a href='https://gettingstartedwithpythonforquantfinance.com/'>Getting Started With Python for Quant Finance</a>**. All code is for educational purposes only. Nothing provided here is financial advise. Use at your own risk."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "2086678f-528d-48e1-9621-76f3f2a80874",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "jupytext": {
   "cell_metadata_filter": "-all",
   "main_language": "python",
   "notebook_metadata_filter": "-all"
  },
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.13"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
